package com.szq.pattern;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.Map;

/**
 * @description: 基础电商推广服务
 *  1、生成最优价商场海报
 *  2、海报含推广邀请码
 * @author: szq
 * @date: 2021-09-11 10:32:44
 */
public abstract class NetMall {

    protected Logger logger = LoggerFactory.getLogger(NetMall.class);

    String uId;
    String uPwd;

    public NetMall(String uId, String uPwd) {
        this.uId = uId;
        this.uPwd = uPwd;
    }

    public String generateGoodsPoster(String skuUrl){
        if (!login(uId, uPwd)){
            return null;
        }
        Map<String, String> reptile = reptile(skuUrl);
        return createBase64(reptile);
    }

    protected boolean login(String uId, String uPwd){
        logger.info("模拟用户登录 uId：{} uPwd：{}", uId, uPwd);
        return true;
    }

    protected abstract Map<String, String> reptile(String skuUrl);

    protected abstract String createBase64(Map<String, String> goodsInfo);

}
